package com.ytd.smartcanteen.weighting.util;

import com.google.gson.reflect.TypeToken;
import com.ytd.common.util.GsonUtil;
import com.ytd.common.util.SPUtils;
import com.ytd.smartcanteen.weighting.bean.MealInfo;

import java.util.List;

/**
 * Your class notes
 *
 * @author gaoguanchao
 * @since 2023/4/23
 */
public class WeightConfig {
    public static List<MealInfo> getCurrentMeals() {
        String currentMeals = SPUtils.getInstance().getString("currentMeals", "");
        return GsonUtil.fromJson(currentMeals, new TypeToken<List<MealInfo>>() {
        }.getType());
    }

    public static void setCurrentMeals(List<MealInfo> list) {
        SPUtils.getInstance().putString("currentMeals", GsonUtil.toJson(list));
    }


    public static String getScalePath() {
        return SPUtils.getInstance().getString("ScalePath", "/dev/ttySAC1");
    }

    public static void setScalePath(String readCardPath) {
        SPUtils.getInstance().putString("ScalePath", readCardPath);
    }

    public static int getScaleBit() {
        return SPUtils.getInstance().getInt("ScaleBit", 9600);
    }

    public static void setScaleBit(int readCardBit) {
        SPUtils.getInstance().putInt("ScaleBit", readCardBit);
    }

    public static String getScannerPath() {
        return SPUtils.getInstance().getString("ScannerPath", "/dev/ttySAC4");
    }

    public static void setScannerPath(String scannerPath) {
        SPUtils.getInstance().putString("ScannerPath", scannerPath);
    }

    public static int getScannerBit() {
        return SPUtils.getInstance().getInt("ScannerBit", 9600);
    }

    public static void setScannerBit(int scannerBit) {
        SPUtils.getInstance().putInt("ScannerBit", scannerBit);
    }

    public static String getLedPath() {
        return SPUtils.getInstance().getString("LedPath", "/dev/ttySAC3");
    }

    public static void setLedPath(String scannerPath) {
        SPUtils.getInstance().putString("LedPath", scannerPath);
    }

    public static int getLedBit() {
        return SPUtils.getInstance().getInt("LedBit", 9600);
    }

    public static void setLedBit(int scannerBit) {
        SPUtils.getInstance().putInt("LedBit", scannerBit);
    }

    public static boolean getAmountCheck() {
        return SPUtils.getInstance().getBoolean("AmountCheck", true);
    }

    public static void setAmountCheck(boolean amountCheck) {
        SPUtils.getInstance().putBoolean("AmountCheck", amountCheck);
    }

    public static String getLocalMerchantId() {
        return SPUtils.getInstance().getString("LocalMerchantId", "");
    }

    public static void setLocalMerchantId(String merchantId) {
        SPUtils.getInstance().putString("LocalMerchantId", merchantId);
    }

    public static long getOverWeightDelayTime() {
        return SPUtils.getInstance().getLong("OverWeightDelayTime", 350L);
    }

    public static void setOverWeightDelayTime(long overWeightDelayTime) {
        SPUtils.getInstance().putLong("OverWeightDelayTime", overWeightDelayTime);
    }

    public static long getSyncTime() {
        return SPUtils.getInstance().getLong("SyncTime", 0L);
    }

    public static void setSyncTime(long syncTime) {
        SPUtils.getInstance().putLong("SyncTime", syncTime);
    }

    public static long getShutdownTime() {
        return SPUtils.getInstance().getLong("ShutdownTime", 0L);
    }

    public static void setShutdownTime(long shutdownTime) {
        SPUtils.getInstance().putLong("ShutdownTime", shutdownTime);
    }


    public static boolean getCalPriceStable() {
        return SPUtils.getInstance().getBoolean("calPriceStable", true);
    }

    public static void setCalPriceStable(boolean calPriceStable) {
        SPUtils.getInstance().putBoolean("calPriceStable", calPriceStable);
    }

    public static boolean getCalPriceSub() {
        return SPUtils.getInstance().getBoolean("calPriceSub", false);
    }

    public static void setCalPriceSub(boolean calPriceSub) {
        SPUtils.getInstance().putBoolean("calPriceSub", calPriceSub);
    }

    public static long getPriceCalTime() {
        return SPUtils.getInstance().getLong("PriceCalTime", 0L);
    }

    public static void setPriceCalTime(long time) {
        SPUtils.getInstance().putLong("PriceCalTime", time);
    }
}
